﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.UI.Common;
using Sinacor.UI.Bovespa.Corretagem.Communication.Bovespa.Ordens.Negocio;

namespace Sinacor.UI.Bovespa.Corretagem.Communication.Translator.DataContractToModel
{
    public class Negocio
    {
        #region [PUB] ToNegocio
        public Model.Bolsa ToNegocio(BolsaResponse from)
        {
            if (from == null) return null;

            return new Model.Bolsa{  Codigo = from.Codigo,
                                     Descricao = from.Descricao
                                   };
        }

        public ModelCollection<Model.Bolsa> ToNegocio(List<BolsaResponse> from)
        {
            if (from == null) return null;

            ModelCollection<Model.Bolsa> retorno = new ModelCollection<Model.Bolsa>();
            
            foreach (BolsaResponse item in from)
            {
                retorno.Add(new Model.Bolsa{
                                            Codigo = item.Codigo,
                                            Descricao = item.Descricao
                                            }
                            );
            }
            return retorno;

        }

        #endregion
    }
}
